<!DOCTYPE html>
<html lang='zh-CN'>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>业务日志</title>
<link rel="icon" href="favicon.ico" type="image/ico">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<link href="css/animate.css" rel="stylesheet">
<link href="css/style.min.css" rel="stylesheet">
<link href="js/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<!--日期选择插件-->
<link rel="stylesheet" href="js/bootstrap-datepicker/bootstrap-datepicker3.min.css">
</head>
<body>
<div class="container-fluid p-t-15">

  <div class="row">
    <div class="col-lg-12">
      <div class="card">
        <div class="card-header">

          <div id="toolbar" class="toolbar-btn-action">
              <form class="form-inline" method="post" id="searchForm">
                <div class="form-group">
                  <label>业务名称:</label>
                  <input type="text" class="form-control" name="logName">
                </div>
                <div class="form-group">
                  <label>操作时间:</label>
                  <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="startTime" placeholder="开始时间"> -
                  <input type="text" class="form-control js-datepicker" data-date-format="yyyy-mm-dd" name="endTime" placeholder="结束时间">
                </div>
                <div class="form-group">
                  <label>日志类型:</label>
                  <select name="logType" class="form-control">
                    <option value="">全部</option>
                    <option value="业务操作日志">业务操作日志</option>
                    <option value="未知异常日志">未知异常日志</option>
                  </select>
                </div>
                <div class="form-group">
                  <button class="btn btn-info btn_query btn-round" type="button" id="searchFormBtn">查询</button>
                  <button class="btn btn-purple btn_query btn-round" type="button" id="watchBtn">查看详情</button>
                </div>
              </form>
          </div>

        </div>
        <div class="card-body">

          <table id="grid_data"></table>

        </div>
      </div>
    </div>

  </div>


  <!--  添加与编辑模态框 -->
  <div class="modal fade" id="addOrEditModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
    <div class="modal-dialog" role="document" style="width: 80%;">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
          <h4 class="modal-title" id="exampleModalLabel">日志详情</h4>
        </div>
        <div class="modal-body">
             <textarea class="form-control" id="message" rows="22" cols="20"></textarea>
        </div>
      </div>
    </div>
  </div>
  <script type="text/javascript" src="js/jquery.min.js"></script>
  <script type="text/javascript" src="js/bootstrap.min.js"></script>
  <script type="text/javascript" src="js/bootstrap-table/bootstrap-table.js"></script>
  <script type="text/javascript" src="js/bootstrap-table/bootstrap-table-zh-CN.min.js"></script>
  <script type="text/javascript" src="js/zero2one/zero2one.version.js"></script>
  <script type="text/javascript" src="js/zero2one/zero2one.core.js"></script>
  <!--日期选择插件-->
  <script src="js/bootstrap-datepicker/bootstrap-datepicker.min.js"></script>
  <script src="js/bootstrap-datepicker/locales/bootstrap-datepicker.zh-CN.min.js"></script>
  <script type="text/javascript" src="js/main.min.js"></script>
  <script type="text/javascript">

          //设置表头
          var columns = [
              {checkbox: true},
              {field: 'log_type',title: '日志类型'},
              {field: 'log_name',title: '日志名称'},
              {field: 'class_name',title: '类名称'},
              {field: 'method_name',title: '方法名称'},
              {field: 'log_staus',title: '操作状态'},
              {field: 'create_time',title: '操作时间', formatter: function (value) {
                      return zero2one.dateFormat(value, 'Y-m-d H:i:s')
                  }},
              {field: 'error_msg',title: '操作描述',visible: false}
          ];

          //进入主界面加载数据
          zero2one.datagrid("grid_data", "/remote/log/list",function (params) {
              return $.extend(zero2one.tableInitParam(params), zero2one.form2json("searchForm"));
          }, columns);

          //点击查询按钮重新加载页面数据
          $("#searchFormBtn").click(function () {
              $('#grid_data').bootstrapTable('refresh');
          });

          zero2one.girdClick("grid_data");

          //点击查看详情
          $("#watchBtn").click(function () {
              //获取选中行的数据
              var datas = $('#grid_data').bootstrapTable('getSelections');
              //判断是否选中行数据，如果没有则提示
              if(datas.length == 1){
                  $("#message").html(datas[0].error_msg);
                  //打开模态框
                  $("#addOrEditModal").modal("show");
              }else{
                  $.messager.alert("温馨提示", "请选择一条数据操作");
              }
          });

  </script>
</div>
</body>
</html>